<?php

require 'lib/model/om/BaseScaraPeer.php';

class ScaraPeer extends BaseScaraPeer
{

    static public function retrieveByPK($pk, PropelPDO $con = null)
    {
        $object = parent::retrieveByPK($pk, $con);

        return $object && $object->getUserId() == sfContext::getInstance()->getUser()->getId() ? $object : null;
    }

    static public function getMainInfo($scara_id)
    {
        $criteria = new UserCriteria(get_class());
        $criteria->add(self::ID, $scara_id);
        $columns = array(self::ADDRESS, self::POSTAL_CODE, self::REMAINING_APS);

        $info = Peer::fetchColumns(get_class(), $criteria, $columns);

        return $info;
    }

}
